<?php

class PhotoController extends SCController {
	
	public function __construct() {
		parent::__construct();
	}
	
	public function index() {}

	/**
	 * 上传单张图片
	 * 从编辑器部分上传
	 */
	public function upload() {
		$tmp_dir = SCConfig::get('UPLOAD_PATH').'/tmp';
		@mkdir($tmp_dir, 777, true);
		list($left, $right) = explode(' ', microtime());
		$tmp_name = $right.(str_pad($left*100000000, 8, STR_PAD_LEFT)).'.tmp';
		$tmp_file = $tmp_dir.'/'.$tmp_name;
		@touch($tmp_file);
		file_put_contents($tmp_file, file_get_contents('php://input'));
		$this->ajaxSuccess($tmp_name);
	}
	
}